OpenGL 3-D Graphics

Microsoft« WindowsáNTÖ Workstation includes high-performance 3-D graphics capabilities as a native part of the operating system using the OpenGL« API (Application Programming Interface). OpenGL is an operating system independent, industry-standard interface for three-dimensional color graphics programming. It is typically used for engineering, visualization, simulation, and other graphics-intensive applications.

IRIS GLÖ, originally developed by Silicon Graphics (SGI), was the precursor to OpenGL. IRIS GL was designed for use on SGI workstation systems as a proprietary graphics engine. Based on customer feedback and the desire to move towards an open systems approach, SGI decided to extend IRIS GL to make it much easier to port to different hardware, operating systems, and windowing systems. The result is OpenGL.

OpenGL is regarded as important technology. PC Magazine recognized this importance when it awarded its 1994 Technical Excellence Award for operating systems to WindowsáNT Workstation version 3.5. As part of the award citation, PC Magazine stated:

"By implementing OpenGL on [Windows] NT, Microsoft brought workstation-class graphics to the PC, and ù finally ù genuine 3-D graphics to Windows«."

Figure 1 - This teapot was created with OpenGL using the Open InventorÖ Toolkit from NeTpowerÖ.

The OpenGL standard is now defined by an Architecture Review Board (ARB) consisting of Digital Equipment Corporation, Evans & Sutherland, IBM, Intel, Intergraph«, Microsoft, and Silicon Graphics. Microsoft and Silicon Graphics have worked together since 1991 in the development of OpenGL for use with the WindowsáNT operating system. With Windows NT Workstation version 3.51, Microsoft has released the second version of OpenGL for this operating systemùoffering improved performance and functions over the first version.

Overview

Advanced 3-D graphics capabilities are needed when users need to visualize large graphics images or huge amounts of data. Workstation systems incorporating OpenGL technology are used by professionals in many fields, including mechanical CAD (Computer Aided Design) design, architectural design, product design, computer animation and simulation, statistical and scientific visualization, medical imaging, and color publishing.

Three-dimensional graphics are also used extensively within many multi-media applications for animation or simulation. For example, OpenGL technology was used to provide special effects in films such as Jurassic Park and Terminator 2, as well as various television series such as Babylon 5. Another area in which 3-D graphics is becoming increasingly popular is in on-line services such as the World-Wide Web, on which the VRML standardùbased in part on OpenGLùmakes it possible to include 3-D scenes and objects in web pages.

Historically, many high-end applications included a proprietary graphics engine, requiring considerable development resources, developed by the vendor. Using an independent operating system API such as OpenGL has made it much easier for applications vendors to focus their development efforts directly on providing additional functionality within their applications.

A number of software vendors who develop CAD applications or who provide authoring tools are also using the WindowsáNT implementation of OpenGL within their applications. A recent 3-D applications conference sponsored by Microsoft drew more than 50 companies developing applications.

Other graphics APIs are also supported with WindowsáNT, such as the Reality Labs API for 3-D graphics and the DirectDraw API, which is designed for very fast 2-D drawing. These graphics APIs are also supported on Windows 95.

WindowsáNT Implementation

Figure 2 - On WindowsáNT, OpenGL graphics can be implemented in any of three modes.

The WindowsáNT Workstation implementation includes all the OpenGL release 1.0 programming interfaces defined by the OpenGL ARB. Microsoft has also defined some extensions to release 1.0 known as "wgl," which glue the OpenGL implementation to the windowing system offered in WindowsáNT Workstation. These interfaces are documented in the WindowsáNT Workstation SDK.

OpenGL is an industry-standard procedural software interface for producing 3-D graphics. It includes approximately 120 commands to draw various primitives such as points, lines, and polygons. OpenGL also includes support for shading, texture mapping, anti-aliasing, lighting, and animation, in addition to support for atmospheric effects such as fogging and simulation of depth-of-field. The rasterization algorithms used by OpenGL are designed for speed. Commands for producing and manipulating higher level and more complex 3-D objects, such as cubes, pyramids, and other objects, are not included, but the commands can be built from the existing primitives.

WindowsáNT Workstation supports OpenGL in three different graphics modes as shown in this figure. Each mode offers different performance characteristics.

Software rendering mode

WindowsáNT Workstation provides basic OpenGL emulation capabilities. As a least common denominator, software rendering mode allows OpenGL to work with any video adapter that is supported with WindowsáNT Workstation. All of the OpenGL operations are executed in software using the WindowsáNT graphics engine. In this environment, OpenGL will not take advantage of accelerated video hardware, but it will work on the minimum supported VGA display with 640x480 resolution and 16 colors. However, it is often desirable to run OpenGL applications with higher resolution and color capabilities. Most S3 video adapters are capable of displaying a larger color palette.

3-D accelerated mode

Users doing serious 3-D imaging work will need performance beyond the basic emulation for CAD design or animation work. Using the standard 3-D Device Driver Interface, video adapter vendors can offer optimized performance for OpenGL applications in device drivers for their existing cards. The 3-D DDI device driver converts an OpenGL call directly to a high performance function that is supported on the video card. In this way, many key OpenGL operations such as z-buffering and "spans" can be executed in hardware., This results in improved performance over the software rendering mode.

OpenGL accelerated mode

The WindowsáNT Workstation implementation of OpenGL also supports workstation class 3-D graphics hardware. This class of hardware offers the highest level of performance and meets the most demanding user needs. In this scenario, the graphics hardware contains the 3-D OpenGL functionalityùWindowsáNT simply passes the OpenGL call straight to the hardware. Most of the OpenGL calls are processed completely by the hardware and very little of the OpenGL code executes in the operating system. This mode results in the best OpenGL 3-D graphics performance.

A number of hardware manufacturers and other graphics vendors are developing OpenGL adapters for the WindowsáNT platform based on the GLiNT chipset offered by 3DLabs. Hardware vendors who are currently shipping or who have announced 3-D accelerated drivers for their existing video adapters or native OpenGL accelerated video adapters for WindowsáNT Workstation include:

AccelGraphics: AG300 series
DEC: ZLXp-E series
ELSA: GLoria adapters
Evans & Sutherland: Freedom PC series
Intergraph: GLI and GLZ adapters
Matrox: MGA Impression Plus
Oki: TrianGL
OmniComp: 3Demon series
SPEA: FireGL adapters

Selected OpenGL Features

Feature Description
Texture mapping Applies an image (such as a bitmap) to a graphics primitive. This feature can be used to generate more realistic images. For example, a table surface can be drawn as a rectangle and a wood-grain texture can be applied to it.
Double buffering Supports contexts with front and back color buffers. Smooth animation can be achieved by drawing into the back buffer, which isn't actively displayed. When the application is ready to display the new image, it simply swaps buffers to the back buffer.
Z-buffering Provides the ability to buffer "depth." This is mainly used for hidden line and hidden surface removal.
Gourad shading Applies smooth shading to a geometric primitive. This computes subtle differences in color across a given surface.
Lighting, materials Accurately computes the color of any point, given material properties such as refraction index and reflection properties for the surface and a lighting model.
Transforms Permits modular relative positioning of different objects in a scene and changes the viewing perspective of an object in 3-D coordinate space.
Anti-aliasing Reduces jagged edges in lines as they are drawn on a computer display.
Alpha blending Specifies an opacity component in addition to RGB color information. Alpha specifies opacity with a range that goes from completely transparent to opaque.

OpenGL Benchmarking Considerations

Prior to evaluating OpenGL applications, there are a number of performance considerations to review. These performance considerations generally are dependent on the way that the OpenGL application implemented certain functions. Many of these considerations are outlined in the following paragraphs. For additional details, please refer to documentation in the Microsoft WindowsáNT SDK and WindowsáNT DDK.

Single-buffer versus double-buffer rendering

Most OpenGL applications perform either single-buffer rendering or double-buffer rendering. In single-buffer mode, pictures are dynamically drawn as they are constructed. Because the process of drawing distracts from the final picture, most applications prefer to use double-buffering, in which pictures are constructed in a back buffer and blt'd to the front buffer when ready. Games and animation packages typically require double-buffering; some CAD packages will run in single-buffer mode if double-buffering is not available.

In single-buffer mode, it is important that glFlush commands be issued regularly. Otherwise, the picture may not be drawn dynamically. An end-user may have to wait for seconds or minutes before anything is drawn if the glFlush command is not issued regularly.

System bus architecture implications

The system bus architecture can create a performance bottleneck in 3-D rendering. The bus limits the pixel throughput to the screen, especially in a software implementation. In particular, this limits the fill and swap buffer rates. A PCI or VESA local bus provides far better rendering performance over an ISA or EISA bus.

Resolution and size

Figure 3 - This picture was modeled using OpenGL

In general, picture resolution and size affect the performance of the software implementation of OpenGL more than the hardware implementation. A larger triangle affects more pixels and, consequently, will take longer to render in the software rendering mode. In a hardware implementation, touching the pixels may be so fast that the time difference of rendering large and small triangles may be negligible compared to the time needed to set up the hardware for the triangle.

Most graphics vendors who quote performance numbers for OpenGL often quote the number of triangles per second they can draw. Most use triangles that have 50 pixels, while some quote numbers with triangles that have 25 pixels. The average size of a typical triangle in a system is dependent on the application and the resolution and size of the display. In terms of resolution, most of today's 3-D games for PC systems run in 320x200 resolution in order to achieve high rates of graphics performance. In the near future, as system performance increases, many will run at a higher resolution.

Color resolution

The number of color bit-planes affects 3D graphics performance. When rendering into a bitmap (or pixmap in X window), the color bit depth of a bitmap is an important performance factor.

Direct rendering versus indirect rendering

Most X-window implementations of OpenGL support direct and indirect rendering. In direct rendering, an application draws directly to the hardware registers on the client side. In indirect rendering, drawing commands are packaged on the client side and sent to the server for rendering via a protocol. In WindowsáNT Workstation, only indirect rendering is currently supported.

Single-threading versus multi-threading

On SMP machines, multi-thread rendering may yield significant performance gains for some applications. Multi-threading may be performed in multiple windows, in multiple bitmaps, in multiple tasks or a combination of the above. An application that takes advantage of multi-threading can perform better than a single-threaded application.

Primitives

OpenGL provides numerous advanced 3-D graphics capabilities. Commonly used primitives include 3-D lighted z-enabled shaded triangle, 2-D flat shaded lines, and perspective-corrected modulated textures. Less commonly used features include accumulation buffer, alpha buffer, stencil buffer, and fog.

Display list versus immediate rendering

An OpenGL application can render a picture directly or by using a display list. A display list caches the commands that can be displayed multiple times. A display list can improve performance in certain hardware or in indirect rendering.

A drawback with display lists is that they contain read-only picture descriptions. If the picture needs modification, a new display list needs to be constructed. As a result, its use is limited to playback and viewing of a final picture.

Floating point

OpenGL applications are floating point intensive. It is important to take into account the floating point performance of the CPU. In general, CPUs such as the Alpha, MIPS«, or PowerPC processors will offer higher levels of performance for OpenGL applications than Intel processors.

Advanced performance considerations

While there are many other performance considerations, such as loop unrolling and other capabilities, it is not the goal of this document to cover all aspects of performance benchmarks.

For more information on the OpenGL API, please read:
3D Computer Graphics by Glassner; Design Press Publishers
OpenGL Programming Guide by Davis, Neider, Woo, OpenGL ARB; Addison-Wesley, ISBN 0-201-63274-8
OpenGL Reference Manual by OpenGL ARB; Addison-Wesley publishers, ISBN 0-201-63276-4


Previous Page
Home

⌐ 1995 Microsoft Corporation
Microsoft and Windows are registered trademarks and WindowsáNT is a trademark of Microsoft Corporation.
IRIS GL, MIPS and Open Inventor are trademarks and OpenGL is a registered trademark of Silicon Graphics, Inc. NeTpower is a trademark of NeTpower, Inc.
0895 Part No. 098-61723